package org.prem.collection.comparator;

import java.util.Comparator;

public class DogComparator implements Comparator{
	
	@Override
	public int compare(Object arg0, Object arg1) {
		Dog d = (Dog)arg0;
		Dog d1 = (Dog)arg1;
		//ascending
/*		if(d.getAge() > d1.getAge()){
			return 1;
		}else if(d.getAge() < d1.getAge()){
			return -1;
		}else{
			return 0;
		}*/
		//descending
		if(d.getAge() > d1.getAge()){
			return -1;
		}else if(d.getAge() < d1.getAge()){
			return 1;
		}else{
			return 0;
		}
	}

}
